import Dinero from "dinero.js";
import Big from "big.js";

export const currencyFormat = (value: number | string | null) => {
  if (value === null || value === undefined || value === "") {
    return "/";
  }
  let bigValue = new Big(value);
  bigValue = bigValue.mul(100);
  return Dinero({ amount: bigValue.toNumber(), currency: "CNY" })
    .setLocale("zh-Hans")
    .toFormat(`$0,0.00`);
};
